-
Notifications
You must be signed in to change notification settings - Fork 162
👷 change e2e implementation for workers #3901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage 🔗 Commit SHA: 1ea0c00 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
0feb678 to
a5b8ded
Compare
9afa674 to
3be6403
Compare
3d6c391 to
4a69138
Compare
test/e2e/lib/framework/pageSetups.ts
Outdated
| export function workerSetup(options: WorkerOptions, servers: Servers) { | ||
| return js` | ||
| ${options.importScripts ? js`importScripts('/datadog-logs.js');` : js`import '/datadog-logs.js';`} | ||
| export function workerSetup(options: SetupOptions, servers: Servers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: as this helper is not really related to the page setup, maybe we could move it to createTest to colocate it with other worker setup code and avoid the back and forth between those files.
test/e2e/lib/framework/createTest.ts
Outdated
| navigator.serviceWorker.register('/sw.js', ${JSON.stringify(options)}).then((registration) => { | ||
| window.myServiceWorker = registration | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: if we don't plan to use interactWithWorker in the coming tests, we could remove it and the window.myServiceWorker reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, I kept the window.myServiceWorker to avoid double registering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can this happen?
4a69138 to
762681a
Compare
test/e2e/lib/framework/createTest.ts
Outdated
| servers.base.bindServerApp( | ||
| createMockServerApp(servers, setup, { | ||
| remoteConfiguration: setupOptions.remoteConfiguration, | ||
| workerImplementation: setupOptions.workerImplementationFactory && workerSetup(setupOptions, servers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: the check is also done inside the function, so we could probably remove it from here
| workerImplementation: setupOptions.workerImplementationFactory && workerSetup(setupOptions, servers), | |
| workerImplementation: workerSetup(setupOptions, servers), |
10587ae to
1ea0c00
Compare
Motivation
The initial implementation of Worker E2E tests was somewhat tied to our specific use case and will not scale if we need to test different scenarios within the Worker environment.
Changes
It introduces a version of
withWorkerthat automatically sets up the logs inside the worker. We can also pass an implementation, similar to what we do withwithLogsandwithBody.Test instructions
All e2e still passed.
Checklist